"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DbConfig = void 0;
const AccountEntity_1 = require("../../account_server/entity/AccountEntity");
const Logger_1 = require("../engine/utils/Logger");
class DbConfig {
    constructor(host, port, user, pass) {
        this.host = "";
        this.port = 3306;
        this.user = "";
        this.pass = "";
        this.host = host;
        this.port = port;
        this.user = user;
        this.pass = pass;
    }
    static init(dbType = DbConfig.Db_Type.Dev) {
        this.now_db_type = dbType;
    }
    static getDbConfig(dbType) {
        let db = this.dbMap.get(dbType);
        if (db) {
            return db;
        }
        else {
            Logger_1.Logger.error("不存在数据库配置:" + dbType);
        }
    }
    static getDbEntity(dbName) {
        return this.dbEntityMap.get(dbName);
    }
}
exports.DbConfig = DbConfig;
DbConfig.Db_Type = {
    Dev: 1,
    Test: 2,
    Online: 3,
};
DbConfig.now_db_type = DbConfig.Db_Type.Test;
DbConfig.Db_Name = {
    db_account: "db_legend_account",
    db_game: "db_legend_game",
    db_admin: "db_legend_admin",
    db_log: "db_legend_log", //日志数据库
};
DbConfig.dbMap = new Map()
    .set(DbConfig.Db_Type.Dev, new DbConfig("121.37.251.120", 3306, "root", "f301517757c8cf6c"))
    .set(DbConfig.Db_Type.Test, new DbConfig("127.0.0.1", 3306, "root", "f301517757c8cf6c"))
    .set(DbConfig.Db_Type.Online, new DbConfig("127.0.0.1", 3306, "root", "f301517757c8cf6c"));
DbConfig.dbEntityMap = new Map()
    .set(DbConfig.Db_Name.db_account, [AccountEntity_1.AccountEntity])
    .set(DbConfig.Db_Name.db_game, [])
    .set(DbConfig.Db_Name.db_admin, [])
    .set(DbConfig.Db_Name.db_log, []);
